package com.householditemtwo.index.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.householditemtwo.common.entity.News;
import com.householditemtwo.common.entity.Newstype;
import com.householditemtwo.common.utils.BaseServlet;
import com.householditemtwo.index.dao.NewsDao;

/**
 * Servlet implementation class NewsServlet
 */
@WebServlet("/NewsServlet")
public class NewsServlet extends 	BaseServlet {
	private static final long serialVersionUID = 1L;
       
	NewsDao dao=new NewsDao();
   

	/**新闻资讯
	 * 
	 */
	public void tonews(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		//调用DAO查询出新闻分类
		List<Newstype> newstypeList=dao.selectNewstype();
		
		//调用Dao查询出新闻详情内容
		List<News> newsList=dao.selectNews();
		
		//把新闻分类信息和新闻详情内容保存到request里面
		request.setAttribute("newstypeList",newstypeList);
		request.setAttribute("newsList", newsList);
		//跳转到
		request.getRequestDispatcher("article_list.jsp").forward(request, response);
		
		
	}

	

}
